<div id="form"></div>
<script>
var frm=$("#form").ajajform({
	header: null,
	footerButtons: [
		{value: "Создать",url: "{{action}}?mode=edit"}
	]
});
var grid=frm.ajajform("insertWidget",null,null,{
	type: "grid",
	title: "Типы транзакций",
	name: "ttypes",
	rowClasses: [{
		name:"ttype",
		columns: [
			{name: "code", label: "Code", width: 150, url: '{{action}}?mode=edit&type_id='},
			{name: "name", label: "Название", width: 400},
			{name: "states_cnt", label: "Состояний", url: '{{action}}?mode=list_states&type_id='},
			{name: "fields_cnt", label: "Полей"}
		]
	}]
});
var ttypes={{JSON:ttypes}};
for (var i=0;i<ttypes.length;i++) {
	var tt=ttypes[i];
	grid.ajajform_grid("insertRow",null,{rowClass: "ttype",cells:[tt.code,tt.name,tt.states_cnt,tt.fields_cnt],id:tt.id});
}
</script>
